package org.yefei.homeworkday12;

public class Triangle {
	// 6：设计三角形类，包括三条边，提供计算三角形的面积(利用海伦公式)和周长的方法
	double a, b, c;

	// 周长
	public double calPerimeter() {
		double p = a + b + c;
		return p;
	}
	// 面积
	public double calArea() {
		double p = calPerimeter() / 2;
		double sqrt = Math.sqrt(p * (p - a) * (p - b) * (p - c));
		return sqrt;
	}

	public static void main(String[] args) {
		Triangle tri = new Triangle();
		tri.a = 7;
		tri.b = 8;
		tri.c = 9;
		double calPerimeter = tri.calPerimeter();
		double calArea = tri.calArea();
		System.out.println("周长是：" + calPerimeter + "面积是：" + calArea);
	}
}
